/*
 * Generated file. 
 * 
 * AuthorProfileHeader.java
 */
package xsp;

import com.ibm.xsp.page.compiled.AbstractCompiledPage;
import com.ibm.xsp.page.compiled.AbstractCompiledPageDispatcher;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import com.ibm.xsp.page.compiled.NoSuchComponentException;
import com.ibm.xsp.page.compiled.PageExpressionEvaluator;
import java.lang.String;
import javax.faces.el.MethodBinding;
import com.ibm.xsp.component.FacesPageProvider;
import com.ibm.xsp.resource.ScriptResource;
import com.ibm.xsp.component.UIViewRootEx2;
import java.lang.Boolean;
import com.ibm.xsp.extlib.component.data.UIFormTable;
import com.ibm.xsp.extlib.component.data.UIFormLayoutRow;
import com.ibm.xsp.component.xp.XspGraphicImage;
import javax.faces.el.ValueBinding;
import com.ibm.xsp.component.xp.XspInputText;
import java.lang.Object;
import com.ibm.xsp.convert.NumberConverter;
import com.ibm.xsp.component.xp.XspOutputLabel;

@SuppressWarnings("all")
public class AuthorProfileHeader extends AbstractCompiledPageDispatcher{
    
    public AuthorProfileHeader() {
        super("3.0");
    }

    protected AbstractCompiledPage createPage(int pageIndex) {
        return new AuthorProfileHeaderPage();
    }
    
    protected boolean isCustomControl() {
        return true;
    }

    public static class AuthorProfileHeaderPage extends AbstractCompiledPage {
        
        private static final ComponentInfo[] s_infos = new ComponentInfo[]{
            ComponentInfo.EMPTY_NORMAL, // 0 "photo"
            new ComponentInfo(false, new int[]{0}), // 1 "formrow1"
            ComponentInfo.EMPTY_NORMAL, // 2 "inputtext7"
            new ComponentInfo(false, new int[]{2}), // 3 "formrow12"
            ComponentInfo.EMPTY_NORMAL, // 4 "inputtext8"
            new ComponentInfo(false, new int[]{4}), // 5 "formrow13"
            ComponentInfo.EMPTY_NORMAL, // 6 "inputtext9"
            new ComponentInfo(false, new int[]{6}), // 7 "formrow14"
            ComponentInfo.EMPTY_NORMAL, // 8 "inputtext11"
            new ComponentInfo(false, new int[]{8}), // 9 "formrow16"
            ComponentInfo.EMPTY_NORMAL, // 10 "inputtext1"
            new ComponentInfo(false, new int[]{10}), // 11 "formrow2"
            ComponentInfo.EMPTY_NORMAL, // 12 "inputtext2"
            new ComponentInfo(false, new int[]{12}), // 13 "formrow3"
            new ComponentInfo(false, new int[]{1, 3, 5, 7, 9, 11, 13}), // 14 "formtable4"
            ComponentInfo.EMPTY_NORMAL, // 15 label
            new ComponentInfo(false, new int[]{14, 15}), // 16 view
        };
        
        public AuthorProfileHeaderPage() {
            super(16, s_infos );
        }
        
        public int getComponentForId(String id) throws NoSuchComponentException { 
            if( "formtable4".equals(id) )
                return 14;
            if( "formrow1".equals(id) )
                return 1;
            if( "photo".equals(id) )
                return 0;
            if( "formrow12".equals(id) )
                return 3;
            if( "inputtext7".equals(id) )
                return 2;
            if( "formrow13".equals(id) )
                return 5;
            if( "inputtext8".equals(id) )
                return 4;
            if( "formrow14".equals(id) )
                return 7;
            if( "inputtext9".equals(id) )
                return 6;
            if( "formrow16".equals(id) )
                return 9;
            if( "inputtext11".equals(id) )
                return 8;
            if( "formrow2".equals(id) )
                return 11;
            if( "inputtext1".equals(id) )
                return 10;
            if( "formrow3".equals(id) )
                return 13;
            if( "inputtext2".equals(id) )
                return 12;
            return -1;
        }
        
        public UIComponent createComponent(int id, FacesContext context,
                UIComponent parent, PageExpressionEvaluator evaluator)
                throws NoSuchComponentException { 
            switch (id) {
            case 16:
                return createView(context, parent, evaluator);
            case 14:
                return createFormtable4(context, parent, evaluator);
            case 1:
                return createFormrow1(context, parent, evaluator);
            case 0:
                return createPhoto(context, parent, evaluator);
            case 3:
                return createFormrow12(context, parent, evaluator);
            case 2:
                return createInputtext7(context, parent, evaluator);
            case 5:
                return createFormrow13(context, parent, evaluator);
            case 4:
                return createInputtext8(context, parent, evaluator);
            case 7:
                return createFormrow14(context, parent, evaluator);
            case 6:
                return createInputtext9(context, parent, evaluator);
            case 9:
                return createFormrow16(context, parent, evaluator);
            case 8:
                return createInputtext11(context, parent, evaluator);
            case 11:
                return createFormrow2(context, parent, evaluator);
            case 10:
                return createInputtext1(context, parent, evaluator);
            case 13:
                return createFormrow3(context, parent, evaluator);
            case 12:
                return createInputtext2(context, parent, evaluator);
            case 15:
                return createLabel(context, parent, evaluator);
            }
            throw new NoSuchComponentException(id);
        }
        
        protected void initIncluderAsRoot(FacesContext context,
                PageExpressionEvaluator evaluator, UIComponent root) {
            String sourceId = "/xp:view[1]/xp:this.beforePageLoad[1]/text()";
            MethodBinding beforePageLoad = evaluator.createMethodBinding(root,
                    "#{javascript:// setup properties for the custom control\n\t\t\tinitAuthorProfile()\n\t\t}",
                    null,null, sourceId);
            FacesPageProvider asPageProvider = root instanceof FacesPageProvider ?
                    (FacesPageProvider) root : null;
            if( null != asPageProvider ){
                asPageProvider.setBeforePageLoad(beforePageLoad);
            }
            ScriptResource resources = new ScriptResource();
            resources.setComponent(root);
            resources.setClientSide(false);
            resources.setSrc("/xpAuthorProfile.jss");
            if( null != asPageProvider ){
                asPageProvider.addResource(resources);
            }
        }

        private UIComponent createView(FacesContext context, 
                UIComponent parent, PageExpressionEvaluator evaluator) {
            UIViewRootEx2 result = new UIViewRootEx2();
            initViewRoot(result);
            String sourceId = "/xp:view[1]/xp:this.beforePageLoad[1]/text()";
            MethodBinding beforePageLoad = evaluator.createMethodBinding(result,
                    "#{javascript:// setup properties for the custom control\n\t\t\tinitAuthorProfile()\n\t\t}",
                    null,null, sourceId);
            result.setBeforePageLoad(beforePageLoad);
            ScriptResource resources = new ScriptResource();
            resources.setComponent(result);
            resources.setClientSide(false);
            resources.setSrc("/xpAuthorProfile.jss");
            result.addResource(resources);
            return result;
        }

        private UIComponent createFormtable4(FacesContext context, 
                UIComponent parent, PageExpressionEvaluator evaluator) {
            // loaded=??
            String loadedBnd = "#{javascript:compositeData.profileFound ? true : false}";
            String sourceId = "formTable4/xp:this.loaded[1]/text()";
            String loaded = evaluator.evaluateAsString(null, loadedBnd, sourceId, boolean.class);
            if ( null != loaded && loaded.length() > 0 &&
                    ! Boolean.parseBoolean(loaded) ) {
                return null;
            } // else loaded was true
            UIFormTable result = new UIFormTable();
            setId(result, "formTable4");
            result.setLegend("Author profile display");
            return result;
        }

        private UIComponent createFormrow1(FacesContext context, 
                UIComponent parent, PageExpressionEvaluator evaluator) {
            UIFormLayoutRow result = new UIFormLayoutRow();
            setId(result, "formRow1");
            result.setLabelPosition("none");
            return result;
        }

        private UIComponent createPhoto(FacesContext context, 
                UIComponent parent, PageExpressionEvaluator evaluator) {
            XspGraphicImage result = new XspGraphicImage();
            result.setWidth("130px");
            result.setStyleClass("xlImage formRowImage");
            result.setHeight("130px");
            result.setTitle("");
            result.setAlt("");
            setId(result, "photo");
            String sourceId = "photo/@url";
            String urlExpr = "#{javascript:compositeData.photoURL}";
            ValueBinding url = evaluator.createValueBinding(result, urlExpr, sourceId,String.class);
            result.setValueBinding("url", url);
            return result;
        }

        private UIComponent createFormrow12(FacesContext context, 
                UIComponent parent, PageExpressionEvaluator evaluator) {
            UIFormLayoutRow result = new UIFormLayoutRow();
            result.setLabel("Email");
            setId(result, "formRow12");
            return result;
        }

        private UIComponent createInputtext7(FacesContext context, 
                UIComponent parent, PageExpressionEvaluator evaluator) {
            XspInputText result = new XspInputText();
            String sourceId = "inputText7/@value";
            String valueExpr = "#{javascript:compositeData.email}";
            ValueBinding value = evaluator.createValueBinding(result, valueExpr, sourceId,Object.class);
            result.setValueBinding("value", value);
            setId(result, "inputText7");
            result.setDisabled(true);
            return result;
        }

        private UIComponent createFormrow13(FacesContext context, 
                UIComponent parent, PageExpressionEvaluator evaluator) {
            UIFormLayoutRow result = new UIFormLayoutRow();
            result.setLabel("Phone");
            setId(result, "formRow13");
            return result;
        }

        private UIComponent createInputtext8(FacesContext context, 
                UIComponent parent, PageExpressionEvaluator evaluator) {
            XspInputText result = new XspInputText();
            String sourceId = "inputText8/@value";
            String valueExpr = "#{javascript:compositeData.phone}";
            ValueBinding value = evaluator.createValueBinding(result, valueExpr, sourceId,Object.class);
            result.setValueBinding("value", value);
            setId(result, "inputText8");
            result.setDisabled(true);
            return result;
        }

        private UIComponent createFormrow14(FacesContext context, 
                UIComponent parent, PageExpressionEvaluator evaluator) {
            UIFormLayoutRow result = new UIFormLayoutRow();
            result.setLabel("Role");
            setId(result, "formRow14");
            return result;
        }

        private UIComponent createInputtext9(FacesContext context, 
                UIComponent parent, PageExpressionEvaluator evaluator) {
            XspInputText result = new XspInputText();
            String sourceId = "inputText9/@value";
            String valueExpr = "#{javascript:compositeData.role}";
            ValueBinding value = evaluator.createValueBinding(result, valueExpr, sourceId,Object.class);
            result.setValueBinding("value", value);
            setId(result, "inputText9");
            result.setDisabled(true);
            return result;
        }

        private UIComponent createFormrow16(FacesContext context, 
                UIComponent parent, PageExpressionEvaluator evaluator) {
            UIFormLayoutRow result = new UIFormLayoutRow();
            result.setLabel("Goals");
            setId(result, "formRow16");
            return result;
        }

        private UIComponent createInputtext11(FacesContext context, 
                UIComponent parent, PageExpressionEvaluator evaluator) {
            XspInputText result = new XspInputText();
            String sourceId = "inputText11/@value";
            String valueExpr = "#{javascript:compositeData.goal}";
            ValueBinding value = evaluator.createValueBinding(result, valueExpr, sourceId,Object.class);
            result.setValueBinding("value", value);
            setId(result, "inputText11");
            result.setDisabled(true);
            return result;
        }

        private UIComponent createFormrow2(FacesContext context, 
                UIComponent parent, PageExpressionEvaluator evaluator) {
            UIFormLayoutRow result = new UIFormLayoutRow();
            result.setLabel("Mains");
            setId(result, "formRow2");
            return result;
        }

        private UIComponent createInputtext1(FacesContext context, 
                UIComponent parent, PageExpressionEvaluator evaluator) {
            XspInputText result = new XspInputText();
            NumberConverter converter = new NumberConverter();
            converter.setIntegerOnly(true);
            result.setConverter(converter);
            String sourceId = "inputText1/@value";
            String valueExpr = "#{javascript:compositeData.postsMain}";
            ValueBinding value = evaluator.createValueBinding(result, valueExpr, sourceId,Object.class);
            result.setValueBinding("value", value);
            setId(result, "inputText1");
            result.setDisabled(true);
            return result;
        }

        private UIComponent createFormrow3(FacesContext context, 
                UIComponent parent, PageExpressionEvaluator evaluator) {
            UIFormLayoutRow result = new UIFormLayoutRow();
            result.setLabel("Responses");
            setId(result, "formRow3");
            return result;
        }

        private UIComponent createInputtext2(FacesContext context, 
                UIComponent parent, PageExpressionEvaluator evaluator) {
            XspInputText result = new XspInputText();
            NumberConverter converter = new NumberConverter();
            converter.setIntegerOnly(true);
            result.setConverter(converter);
            String sourceId = "inputText2/@value";
            String valueExpr = "#{javascript:compositeData.postsResponses}";
            ValueBinding value = evaluator.createValueBinding(result, valueExpr, sourceId,Object.class);
            result.setValueBinding("value", value);
            setId(result, "inputText2");
            result.setDisabled(true);
            return result;
        }

        private UIComponent createLabel(FacesContext context, 
                UIComponent parent, PageExpressionEvaluator evaluator) {
            // loaded=??
            String loadedBnd = "#{javascript:compositeData.profileFound ? false : true}";
            String sourceId = "/xp:view[1]/xp:label[1]/xp:this.loaded[1]/text()";
            String loaded = evaluator.evaluateAsString(null, loadedBnd, sourceId, boolean.class);
            if ( null != loaded && loaded.length() > 0 &&
                    ! Boolean.parseBoolean(loaded) ) {
                return null;
            } // else loaded was true
            XspOutputLabel result = new XspOutputLabel();
            result.setValue("User has no details");
            return result;
        }

    }
}
